from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage

# 配置连接到本地 Ollama
chat = ChatOpenAI(
    base_url="http://192.168.77.3:11434/api/chat",  # Ollama 的 OpenAI 兼容端点
    model="deepseek-r1:32b",
    api_key="ollama"  # 可随意填写
)

# 发送请求
messages = [HumanMessage(content="Hello!")]
response = chat.invoke(messages)

print(response.content)